/*
 *    Copyright (c) 2018-2025, cloud All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the pig4cloud.com developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: cloud
 */

package com.fuyao.cloud.asset.entity.warehous;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fuyao.cloud.asset.util.AssetUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 入库清单
 *
 * @author liyue
 * @date 2021-12-06 20:19:48
 */
@Data
@TableName("fy_asset_in_warehous_list")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "入库清单")
public class WarehousList extends Model<WarehousList> {

	private static final long serialVersionUID = 1L;

	/**
	 * 主键ID
	 */
	@TableId
	@ApiModelProperty(value = "主键ID")
	private Long id;

	/**
	 * 创建人ID
	 */
	@TableField(fill = FieldFill.INSERT)
	@ApiModelProperty(value = "创建人ID")
	private Long createId;

	/**
	 * 创建人姓名
	 */
	@TableField(fill = FieldFill.INSERT)
	@ApiModelProperty(value = "创建人姓名")
	private String createBy;

	/**
	 * 状态：默认为0{0：草稿、3：已完成
	 */
	@ApiModelProperty(value = "状态：默认为0{0：草稿、3：已完成")
	private Integer status;

	@ApiModelProperty(value = "次入库单ID")
	private Long warehousId;

	/**
	 * 父订单ID 同属性复制原则。
	 */
	@ApiModelProperty(value = "父订单ID-验收单ID")
	private Long parentId;

	/**
	 * 父订单单号
	 */
	@ApiModelProperty(value = "父订单单号")
	private String parentCaseid;

	/**
	 * 数据删除标记
	 */
	@ApiModelProperty(value = "数据删除标记")
	private String delFlag;

	/**
	 * 租户ID
	 */
	@ApiModelProperty(value = "租户ID")
	private Long tenantId;

	/**
	 * 创建人所属OU的全称
	 */
	@ApiModelProperty(value = "创建人所属OU的全称")
	private String deptFullname;

	/**
	 * 创建人所属OU的ID
	 */
	@ApiModelProperty(value = "创建人所属OU的ID")
	private Long deptId;

	/**
	 * 创建时间
	 */
	@ApiModelProperty(value = "创建时间")
	private LocalDateTime createTime;

	/**
	 * 批次号
	 */
	@ApiModelProperty(value = "批次号")
	private String batchnumber;

	/**
	 * 资产分类全编码
	 */
	@ApiModelProperty(value = "资产分类全编码")
	private String classifiedCode;

	/**
	 * 资产分类全名称
	 */
	@ApiModelProperty(value = "资产分类全名称")
	private String classified;

	/**
	 * 资产分类名称
	 */
	@ApiModelProperty(value = "资产分类名称")
	private String ctiName;

	/**
	 * 资产分类ID
	 */
	@ApiModelProperty(value = "资产分类ID")
	private Long ctiId;

	/**
	 * 照片
	 */
	@ApiModelProperty(value = "照片")
	private String photo;

	/**
	 * 条形码
	 */
	@ApiModelProperty(value = "条形码")
	private String barcode;

	/**
	 * 名称
	 */
	@ApiModelProperty(value = "名称")
	private String name;

	/**
	 * 规格型号
	 */
	@ApiModelProperty(value = "规格型号")
	private String model;

	/**
	 * 计量单位
	 */
	@ApiModelProperty(value = "计量单位")
	private String unit;

	/**
	 * 单价
	 */
	@ApiModelProperty(value = "单价")
	private BigDecimal price;

	/**
	 * 总价
	 */
	@ApiModelProperty(value = "总价")
	private BigDecimal amount;


	@TableField(exist = false)
	private Long amountLong;

	/**
	 * 合同或发票ID
	 */
	@ApiModelProperty(value = "合同或发票ID")
	private Long contractId;

	/**
	 * 合同或发票编号
	 */
	@ApiModelProperty(value = "合同或发票编号")
	private String contractNumber;

	/**
	 * 合同或发票名称
	 */
	@ApiModelProperty(value = "合同或发票名称")
	private String contractName;

	/**
	 * 供应商ID
	 */
	@ApiModelProperty(value = "供应商ID")
	private Long supplierId;

	/**
	 * 供应商名称
	 */
	@ApiModelProperty(value = "供应商名称")
	private String supplierName;

	/**
	 * 存放房间名称
	 */
	@ApiModelProperty(value = "存放房间名称")
	private String houseName;

	/**
	 * 存放房间ID
	 */
	@ApiModelProperty(value = "存放房间ID")
	private Long houseId;

	/**
	 * 存放位置名称
	 */
	@ApiModelProperty(value = "存放位置名称")
	private String locationName;

	/**
	 * 存放位置id
	 */
	@ApiModelProperty(value = "存放位置id")
	private Long locationId;

	/**
	 * 存放地点全名称
	 */
	@ApiModelProperty(value = "存放地点全名称")
	private String fullLocation;

	/**
	 * 采购方式01：邀标、02：自采:03：政府采购
	 */
	@ApiModelProperty(value = "采购方式01：邀标、02：自采:03：政府采购")
	private String method;

	/**
	 * 详细配置
	 */
	@ApiModelProperty(value = "详细配置")
	private String detailed;

	/**
	 * 申请数量
	 */
	@ApiModelProperty(value = "申请数量")
	private Long quantity;

	@ApiModelProperty(value="资产ID")
	private Long assetCardId;

	/**
	 * 备注
	 */
	@ApiModelProperty(value = "备注")
	private String remarks;

	/**
	 * 资产编码
	 */
	@ApiModelProperty(value="资产编码")
	private String number;

	public String getStatusCn(){
		return AssetUtils.formatStatus(String.valueOf(this.status));
	}

	public Long getAmountLong() {
		return this.amount.longValue();
	}
}
